//
//  REProblemDetailsViewController.m
//  录音
//
//  Created by ywy on 2017/1/3.
//  Copyright © 2017年 Wely. All rights reserved.
//

#import "REProblemDetailsViewController.h"
#import "RECheckLogin.h"
#import <SVProgressHUD/SVProgressHUD.h>


@interface REProblemDetailsViewController ()

@end

@implementation REProblemDetailsViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.title = self.Model.questionName;
    
    UIBarButtonItem * rightItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(backPop)];
    self.navigationItem.leftBarButtonItem = rightItem;
    //        self.title = @"帮助与反馈";
}

-(void)backPop
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.headTitleStr.text = self.Model.questionName;
    [self requestBase];
    
    // Do any additional setup after loading the view from its nib.
}
-(void)requestBase
{
    __weak typeof(self) weakSelf = self;
    NSMutableDictionary * dict = [NSMutableDictionary new];
    dict[@"cmd"] =  @"getQuestionDetail";
    dict[@"questionId"]  =self.Model.questionId;
    [SVProgressHUD showWithStatus:@"网络加载中....."];
    [RECheckLogin POST:REBaseUrl parameters:dict progress:^(CGFloat prosser) {
        
    } success:^(id responseObject) {
        if ([responseObject[@"result"] isEqualToString:@"0"]) {
//            weakSelf.headTitleStr.text = responseObject[@"questionName"];
            [weakSelf.baseWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",responseObject[@"questionAnswer"]]]]];
            [SVProgressHUD dismiss];
        }else
        {
            [SVProgressHUD showErrorWithStatus:responseObject[@"resultNote"]];
        }
          [SVProgressHUD dismiss];
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"网络加载失败！！！"];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
